package com.bwie.auth.controller;

import com.bwie.auth.service.AuthService;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    @PostMapping("/userLogin")
    public Result userLogin(@RequestBody User user){
        Result result = authService.userLogin(user);
        return result;
    }

    @GetMapping("/info")
    public Result info(){
        User info = authService.info();
        return Result.success(info);
    }

    @PostMapping("/logout")
    public Result logout(){
        authService.logout();
        return Result.success();
    }

}
